package top.itaso.app.ui.demos;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import java.util.ArrayList;

public class DemosViewModel extends ViewModel {

    private MutableLiveData<ArrayList<DemoItemDTO>> _demos;
    public LiveData<ArrayList<DemoItemDTO>> demos;

    public DemosViewModel() {
        _demos = new MutableLiveData<>();
        demos = _demos;
        _demos.setValue(makeDemos());
    }

    /**
     * 添加 Demo 示例，有新增 预研项，可在这边追加数据
     *
     * @return
     */
    private ArrayList<DemoItemDTO> makeDemos() {
        ArrayList<DemoItemDTO> demoResult = new ArrayList<>();

        DemoItemDTO demoTitleBar = new DemoItemDTO(demoResult.size() + 1, "作者：itaso", "问答：itsdf07", DemoItemDTO.EDemoKey.DEMO_IWB_WIDGET, "2022/08/19", true);
        demoResult.add(demoTitleBar);

        DemoItemDTO demoButtonsStatus = new DemoItemDTO(demoResult.size() + 1, "作者：itaso", "问答：itsdf07", DemoItemDTO.EDemoKey.DEMO_BTNS, "2023/02/16", true);
        demoResult.add(demoButtonsStatus);

        DemoItemDTO multiLevel_RecyclerView = new DemoItemDTO(demoResult.size() + 1, "作者：itaso", "问答：itsdf07", DemoItemDTO.EDemoKey.DEMO_MULTI_LIST, "2021/11/30", true);
        multiLevel_RecyclerView.setPrivateModule(true);
        demoResult.add(multiLevel_RecyclerView);

        DemoItemDTO multiLevel_ExpandListView = new DemoItemDTO(demoResult.size() + 1, "作者：itaso", "问答：itsdf07", DemoItemDTO.EDemoKey.DEMO_MULTI_EXPANDABLE, "2021/12/05", true);
        demoResult.add(multiLevel_ExpandListView);

        DemoItemDTO apps = new DemoItemDTO(demoResult.size() + 1, "作者：itaso", "问答：itsdf07", DemoItemDTO.EDemoKey.DEMO_APPS, "2024/03/27", true);
        demoResult.add(apps);

        DemoItemDTO demoProgressBar = new DemoItemDTO(demoResult.size() + 1, "作者：itaso", "问答：itsdf07", DemoItemDTO.EDemoKey.DEMO_PROGRESSBAR_UPLOAD, "2021/12/07", true);
        demoResult.add(demoProgressBar);

        DemoItemDTO demoWifi = new DemoItemDTO(demoResult.size() + 1, "作者：itaso", "问答：itsdf07", DemoItemDTO.EDemoKey.DEMO_WIFI_SCAN, "2022/01/18", true);
        demoResult.add(demoWifi);

        DemoItemDTO demoPicker = new DemoItemDTO(demoResult.size() + 1, "作者：itaso", "问答：itsdf07", DemoItemDTO.EDemoKey.DEMO_PICKER, "2022/01/20", true);
        demoResult.add(demoPicker);

        DemoItemDTO demoFloatingWindow = new DemoItemDTO(demoResult.size() + 1, "作者：itaso", "问答：itsdf07", DemoItemDTO.EDemoKey.DEMO_FLOATING_WINDOW, "2022/01/25", true);
        demoResult.add(demoFloatingWindow);

        DemoItemDTO demoTts = new DemoItemDTO(demoResult.size() + 1, "作者：itaso", "问答：itsdf07", DemoItemDTO.EDemoKey.DEMO_TTS, "2022/04/14", true);
        demoResult.add(demoTts);

        DemoItemDTO demoMediaplayer = new DemoItemDTO(demoResult.size() + 1, "作者：itaso", "问答：itsdf07", DemoItemDTO.EDemoKey.DEMO_MEDIAPLAYER, "2023/07/24", true);
        demoResult.add(demoMediaplayer);

        return demoResult;
    }

}